package com.ptl.bp.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.ptl.bp.config.enums.UserRole;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Table;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;

@Schema(description = "系统用户实体")
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "sys_user")
@Entity(name = "sys_user")
@Table(appliesTo = "sys_user", comment = "用户信息")
public class UserEntity extends BaseEntity {

    @Column(nullable = false, unique = true, length = 50)
    @Schema(description = "用户名", example = "admin")
    private String username;

    @Column(length = 100)
    @Schema(description = "头像", example = "https://xxx")
    private String avatar;

    @Column(length = 100)
    @Schema(description = "邮箱", example = "xx@xx")
    private String email;

    @Column(nullable = false, length = 100)
    @Schema(description = "加密密码")
    private String password;

    @Enumerated(EnumType.STRING)
    @Column(nullable = false)
    @Schema(description = "用户角色", example = "ADMIN", implementation = UserRole.class)
    private UserRole role;

}

